package com.issac.demo.pooled2.mydatasource;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * @author: ywy
 * @date: 2023-06-28
 * @desc:
 */
public class JdbcTest {
    public static void main(String[] args)  throws Exception{
        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection connection = DriverManager.getConnection(
                "jdbc:mysql://localhost/foodie-shop-dev",
                "root", "rootroot"
        );
        PreparedStatement preparedStatement = connection.prepareStatement("select * from orders");
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()) {
            System.out.println(resultSet.getString(1));
        }
        resultSet.close();
        preparedStatement.close();;
        connection.close();
    }
}
